﻿using Iit.ITBI.MDSManager.Microsoft.MasterDataServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;

namespace Iit.ITBI.MDSManager
{
    abstract class CustomObject
    {

        public string Name
        {
            get;
            set;
        }
        public Guid MUID
        {
            get;
            set;
        }
        public int ID
        {
            get;
            set;
        }
        public string Code
        {
            get;
            set;
        }
        public bool IsSystem
        {
            get;
            set;
        }

        public Identifier Identifier
        {
            get;
            set;
        }

        public bool Exists
        {
            get;
            set;
        }

        protected void Initialize()
        {
            this.IsSystem = false;

            this.Identifier = new Identifier();
            this.Identifier.Id = this.MUID;
            this.Identifier.Name = this.Name;
        }

        public CustomObject(string Name, Guid MUID)
        {
            this.Name = Name;
            this.MUID = MUID;
            
            this.Initialize();

        }

        public CustomObject() { }

        public override string ToString()
        {
            StringBuilder str = new StringBuilder();

            str.AppendLine(string.Format("Name = \"{0}\", ID = \"{1}\", MUID = \"{2}\", Exists = \"{3}\";", this.Name, this.ID, this.MUID, this.Exists));
            
            return str.ToString();
        }

    }
}
